package com.itheima.app.controller;

import com.itheima.app.manager.TestSoulManager;
import com.itheima.vo.Answers;
import com.itheima.vo.AnswersVo;
import com.itheima.vo.ReportVo;
import com.itheima.vo.TopicVo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 测灵魂模块
 */
@RestController
@Slf4j
public class TestSoulController {

    @Autowired
    private TestSoulManager testSoulManager;

    @GetMapping("/testSoul")
    public List<TopicVo> testSoul() {
        log.info("开始执行测试灵魂");
        return testSoulManager.testSoul();
    }

    @PostMapping("/testSoul")
    public Integer answer(@RequestBody AnswersVo answers) {
        return testSoulManager.answer(answers);
    }

    @GetMapping("/testSoul/report/{id}")
    public ReportVo report(@PathVariable Long id) {
        return testSoulManager.report(id);
    }

}
